class FoodRatings 
{
    public:
        unordered_map<string, pair<int, string>> food_map;
        unordered_map<string, set<pair<int, string>>> cuisine_map;
        FoodRatings(vector<string>& foods, vector<string>& cuisines,
                    vector<int>& ratings) {
            int n = foods.size();
            for (int i = 0; i < n; i++) {
                food_map[foods[i]] = {ratings[i], cuisines[i]};
                cuisine_map[cuisines[i]].emplace(-ratings[i], foods[i]);
            }
        }
    
        void changeRating(string food, int newRating) {
            auto & [r,c] = food_map[food];
            auto & st = cuisine_map[c];
            st.erase({-r,food});
            st.emplace(-newRating,food);
            r = newRating;
        }
    
        string highestRated(string cuisine) {
            return cuisine_map[cuisine].begin()->second;
        }
    };
    /**
     * Your FoodRatings object will be instantiated and called as such:
     * FoodRatings* obj = new FoodRatings(foods, cuisines, ratings);
     * obj->changeRating(food,newRating);
     * string param_2 = obj->highestRated(cuisine);
     */